package com.atguigu.gulimall.member.web;

import com.alibaba.fastjson.JSONObject;
import com.atguigu.common.utils.R;
import com.atguigu.gulimall.member.feign.OrderFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

/**
 * @Description
 * @Author lhj
 * @Date 2024/5/25 14:26
 */
@Slf4j
@Controller
public class MemberWebController {
    
    @Autowired
    OrderFeignService orderFeignService;
    
    @GetMapping("/memberOrder.html")
    public String memberOrderPage(@RequestParam(value = "page", defaultValue = "1") String page, Model model) {
        Map<String, Object> params = new HashMap<>();
        params.put("page", page);
        R r = orderFeignService.listWithItem(params);
        log.info("order list with item result: {}", JSONObject.toJSONString(r));
        model.addAttribute("orderResp", r);
        return "orderList";
    }
    
}
 